﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace GoPlay.Models
{
    public class Team : IEntity
    {
        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The team name must be at least 2 characters long.", MinimumLength = 2)]
        [DataType(DataType.Text)]
        [Display(Name = "Team Name")]
        public string Name { get; set; }

        // Foreign key to UserProfile in Membership Services
        [ForeignKey("UserProfile")]
        public int UserId { get; set; }
        public virtual UserProfile UserProfile { get; set; }

        public ICollection<Game> Games { get; set; }
        public ICollection<Player> Players { get; set; }
    }
}